Skip to content

Attempt to make codecov less important #1203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 62 commits into
base: main
Choose a base branch
from
Draft

Conversation

kingbuzzman
Copy link
Contributor

@kingbuzzman kingbuzzman commented May 26, 2025

Depends on #1202
Related to #1201 -- had to close it due to CI not running

This all started because yesterday codecov was having issues, and p!$#ed me off...

This PR aims to reduce the emphasis on Codecov by adjusting coverage exclusions in pyproject.toml and modifying the CI workflow to handle coverage reporting differently.

  • Update pyproject.toml by excluding "pytest_django/_version.py" in both run and report configurations.
  • Revise the CI workflow to use ubuntu-latest, update Tox versions, and introduce dedicated coverage reporting and artifact handling steps.

Miscellaneous:

  • CI now runs on all branches -- instead of those that were pointing to main only
  • Updated tox version since python 3.8 is gone!
  • Added html and the main coverage file to the archive
  • Adds markdown details of coverage in the CI summary
  • Moves the CI matrix up -- personal thing, i can move it back if its too many changes
image

@kingbuzzman kingbuzzman marked this pull request as draft May 26, 2025 16:26
@kingbuzzman kingbuzzman changed the base branch from main to dev/remote-py38 May 26, 2025 16:39
@kingbuzzman kingbuzzman changed the base branch from dev/remote-py38 to main May 26, 2025 16:44
@kingbuzzman kingbuzzman changed the base branch from main to dev/remote-py38 May 26, 2025 16:46
Base automatically changed from dev/remote-py38 to main May 26, 2025 21:35
@webknjaz
Copy link
Member

webknjaz commented Jun 4, 2025

I, however, like how Codecov can produce multiple checks aggregating different aspects of coverage..

can you be specific about what it is you like about it?

Having it apply flags for different runtimes et al. I was mostly pointing out that it's useful to have this combined thing as long as Codecov integration isn't compromised.
In general, I have a set of practices I deploy to make Codecov more predictable/responsive. This is largely about configuration. Additionally, pinning things is helpful. The official Codecov action downloads an uploader defaulting to latest instead of a specific version, for example. If pinned, it can contribute to overall stability. Two other things I typically do is having a plain-text token in the config (it's not really that important to have it secret) and replacing Codecov's polling for whether the CI completed and attempting to report statuses too early with a number of reports to wait for, which would match the number of uploading jobs.

@webknjaz
Copy link
Member

webknjaz commented Jun 4, 2025

FWIW, it's good to still upload separate reports from jobs because they get different flags/contexts assigned that are usable in the web UI, similar to the contexts that coveragepy can include.

kingbuzzman and others added 2 commits June 4, 2025 08:44
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@kingbuzzman
Copy link
Contributor Author

@webknjaz

This is is the codecov report for this PR
This is main

I see extra context on the right in main, but seems a bit useless. what am i missing?

This was referenced Jun 4, 2025
@kingbuzzman
Copy link
Contributor Author

@webknjaz what am i missing from the codecov report, the summed up report vs individual ^ (see comment above)

@kingbuzzman kingbuzzman requested a review from webknjaz June 5, 2025 20:12
@kingbuzzman
Copy link
Contributor Author

@webknjaz ?

@webknjaz
Copy link
Member

I see extra context on the right in main, but seems a bit useless. what am i missing?

The PR views are different and sometimes inaccurate in Codecov. I recommend always consulting the linked HEAD commit page. Commit pages contain the uploads lists that are downloadable and linked to the corresponding jobs. Plus, PR views often misrepresent covered lines in patch widgets.

@webknjaz
Copy link
Member

what am i missing from the codecov report, the summed up report vs individual ^

@kingbuzzman you're missing flags that can tell you exactly what environments covered each line. You should start setting them, though.

Comment on lines -68 to -74
- name: Report coverage
- name: Prepare coverage file for upload
if: contains(matrix.name, 'coverage')
uses: codecov/codecov-action@v5
run: mv .coverage coverage.${TOXENV}

- name: Upload temporary coverage artifact
if: contains(matrix.name, 'coverage')
uses: actions/upload-artifact@v4
with:
fail_ci_if_error: true
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, it'd be good to compute flags based on the matrix and env, as follows: https://github.com/tox-dev/workflow/blob/208490c/.github/workflows/reusable-tox.yml#L433-L444

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, i'm playing with it now, thanks!

path: htmlcov
retention-days: ${{ steps.determine-retention-days.outputs.retention_days }}

- name: Delete temporary coverage artifacts from run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't really that necessary, as you already set them to expire in one day. Plus, it'd be impossible to inspect these files whenever you suspect something's wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. But its just noise, i figure i'd leave it "clean" -- but you're not wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just that I've recently seen a DIY implementation of this causing CI stability issues due to GH API or network being flaky and causing chaos. That memory is still fresh :)

But also, these are about inspectability.

If you want fewer artifacts, you can run actions/upload-artifact/merge and it'll do the deletion for you, replacing these with one artifact containing all the individual files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that i like! Thanks!

kingbuzzman and others added 2 commits June 16, 2025 04:43
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
@kingbuzzman kingbuzzman marked this pull request as draft June 16, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants